import {
	getBaseUrl,
	getSmartLockBaseUrl
}
from '@/api/config.js'
import {
	request,
	header
} from '@/api/request.js'

export const apis = {
	// 数字杰能App登录
	login(params) {
		return request({
			header: header(),
			url: getBaseUrl() + "/login",
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 获取升级信息
	checkUpgradeInfo(params) {
		return request({
			header: header(),
			url: getBaseUrl() + "/applet/up",
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 智能锁用户登录
	smartLockLogin(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/login",
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 用户信息接口
	getUserInfo(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/getUserInfo",
			data: params,
			method: 'GET',
			noShow: false
		})
	},
	// 获取字典数据接口
	getDictData(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/app/dictData",
			method: 'GET',
			noShow: false
		})
	},
	// 查询所有字典值接口
	getAllDict(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/app/getAllDictData",
			method: 'GET',
			noShow: false
		})
	},
	// 首页搜索接口
	getSearch(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/app/search?searchValue=${params.searchValue}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 锁具详情接口
	getDeviceDetail(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/device/getById?deviceId=${params.deviceId}&deviceType=${params.deviceType}`,
			method: 'GET',
			noShow: false
		})
	},
	// 车站列表
	getTenant(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/app/tenant/list",
			method: 'GET',
			noShow: false
		})
	},
	// 门锁记录分页列表
	getRecord(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/device/getRecord/?tenantId=${params.tenantId}&queryTimeType=${params.queryTimeType}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 查询门锁记录详情接口
	getRecordDetail(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/device/getRecord/${id}`,
			method: 'GET',
			noShow: false
		})
	},
	// 查询未授权设备信息接口(门禁权限申请列表)
	getUnAuthorizeDevices(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/device/getUnAuthorizeDevices/?tenantId=${id}&deviceType=DOOR`,
			method: 'GET',
			noShow: false
		})
	},
	// 授权申请接口
	authorizeApplyCreate(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/authorize/apply/create",
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 授权记录分页列表接口
	getAuthorizeApplyList(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/authorize/apply/page?tenantId=${params.tenantId}&applyStatus=${params.applyStatus}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 授权记录详情接口
	getAuthorizeApplyDetail(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/authorize/apply/${id}`,
			method: 'GET',
			noShow: false
		})
	},
	// 授权审批接口
	authorizeApplyApprove(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + "/authorize/apply/approve",
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 卡片列表接口
	getCardList(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/card/getPage?tenantId=${params.tenantId}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 卡片详情接口
	getCardDetail(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/card/getInfo?cardId=${id}`,
			method: 'GET',
			noShow: false
		})
	},
	// 此接口用户门禁和无源锁具，开门前校验！
	checkAuthorize(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + '/authorize/checkAuthorize',
			data: params,
			method: 'POST',
			noShow: false
		})
	},
	// 锁具列表接口
	getLockList(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/device/getPage?tenantId=${params.tenantId}&deviceType=${params.deviceType}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 查询锁具设备详情接口(扫无源锁后调的)
	getLockDetail(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/device/getLock?deviceNo=${params.deviceNo}`,
			method: 'GET',
			noShow: false
		})
	},
	// 消息列表接口
	getNoticeList(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/app/notice/list?tenantId=${params.tenantId}&queryTimeType=${params.queryTimeType}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 消息详情接口
	getNoticeDetail(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/app/notice/getAlarmNoticeInfo?noticeId=${id}`,
			method: 'GET',
			noShow: false
		})
	},
	// 消息已读接口
	getReadNotice(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + '/app/notice/readNotice',
			method: 'POST',
			data: params,
			noShow: false
		})
	},
	// 审批列表
	getApproveList(params) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() +
				`/authorize/approve/page?tenantId=${params.tenantId}&status=${params.status}&pageNum=${params.pageNum}&pageSize=${params.pageSize}`,
			method: 'GET',
			noShow: false
		})
	},
	// 审批详情
	getApproveDetail(id) {
		return request({
			header: header(),
			url: getSmartLockBaseUrl() + `/authorize/approve/info?authorizeId=${id}`,
			method: 'GET',
			noShow: false
		})
	},
}